Skip to content

Conversation

@iangmaia
Copy link
Contributor

@iangmaia iangmaia commented Oct 30, 2025

See AINFRA-1478

Description

This PR enhances the version handling added in the previous iteration to assume the version received by the code freeze lane as the source of truth, ignoring potential mismatches between the ReleasesV2 version and the project's computed version.

Testing

You can make sure the calculated release branch, current version and the next version are correctly shown in the "Continue" prompt. Just remember to answer N when asked to continue, to cancel the actual code freeze.

To avoid unexpected results, comment out the lines doing ensure_git_status_clean and Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) at the beginning of the lane.

You can run the code_freeze lane, with and without the version parameters:

  • Run bundle exec fastlane code_freeze
  • Run bundle exec fastlane code_freeze version:30.6

This will be fully tested in the next release cycle during code freeze.

@iangmaia iangmaia self-assigned this Oct 31, 2025
@iangmaia iangmaia added this to the 26.4 milestone Oct 31, 2025
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from 92ad71d to 4ee319c Compare October 31, 2025 22:23
@iangmaia iangmaia marked this pull request as ready for review October 31, 2025 22:26
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from 4ee319c to f6b5eb1 Compare November 7, 2025 15:18
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 7, 2025

1 Warning
⚠️ This PR is assigned to the milestone 26.4. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@iangmaia iangmaia changed the title [Tooling] Fail on Version Mismatch Between ReleasesV2 and Project [Tooling] Use ReleasesV2 version as the source of truth during Code Freeze Nov 7, 2025
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from 760d9e8 to 077ed62 Compare November 7, 2025 21:42
@twstokes
Copy link
Contributor

I applied the following patch:

diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb
index 9d234d8032c..98b8d7f3c03 100644
--- a/fastlane/lanes/release.rb
+++ b/fastlane/lanes/release.rb
@@ -8,9 +8,9 @@ platform :android do
   # @param [Boolean] skip_confirm Whether to skip the confirmation prompt
   #
   lane :code_freeze do |version: nil, skip_confirm: false|
-    ensure_git_status_clean
+    #ensure_git_status_clean
 
-    Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
+    #Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
 
     # If a new version is passed, use it as source of truth from now on
     new_version = version || next_release_version

and ran bundle exec fastlane code_freeze and got:

      Code Freeze:
      • New release branch from trunk: release/26.4

      • Current release version and build code: 26.3 (1477).
      • New release version and build code: 26.4-rc-1 (1478).

Running bundle exec fastlane code_freeze version:30.6 gave me:

      Code Freeze:
      • New release branch from trunk: release/30.6

      • Current release version and build code: 26.3 (1477).
      • New release version and build code: 30.6-rc-1 (1478).

Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Didn't test locally because @twstokes already did that.

Comment on lines 114 to 115
version_name ||= VERSION_FILE.read_version_name
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to https://github.com/woocommerce/woocommerce-ios/pull/16296/files#r2512589279. We could move the comment back where the read happens:

Suggested change
version_name ||= VERSION_FILE.read_version_name
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
# Read the current release version from `version.properties` and parse it into an AppVersion object,
# unless already provided
version_name ||= VERSION_FILE.read_version_name

or just do without:

Suggested change
version_name ||= VERSION_FILE.read_version_name
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
version_name ||= VERSION_FILE.read_version_name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Tried to improve all the comments for this method on 70ceff9.

@sonarqubecloud
Copy link

@iangmaia iangmaia merged commit a18c70b into trunk Nov 11, 2025
22 checks passed
@iangmaia iangmaia deleted the iangmaia/fail-when-code-freeze-version-mismatch branch November 11, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants